import request from "@/axios/request";

/**
 * 添加用户的方法
 * @param {Object} data - 用户数据对象
 * @returns {Promise} - 返回一个Promise对象，包含请求的响应结果
 */
export const addUser = (data) => { // 使用箭头函数定义添加用户的方法
  return request({ url: "/user/add" ,data, method: "post" });
};

export const loginUser = (data) => {
  return request({ url: "/user/login" ,data, method: "post" });
};

export const downLoad3D = (data) => {
  return request({ url: "/api/meshy/download", data, method: "post" });
};

export const userRegister = (data) => {
  return request({ url: "/user/register", data, method: "post" });
}

export const imageTo3D = (data) => {
  return request({ url: "/meshy/image-to-3d/preview", data, method: "post"});
};

export const modifyPassword = (data) => {
  return request({ url: "/user/modifyPassword", data, method: "post" });
}

export const modifyPasswordByEmail = (data) => {
  return request({ url: "/user/modifyPasswordByEmail", data, method: "post" });
}

export const textTo3d = (data) => {
  return request({ url: "/meshy/text-to-3d/preview", data, method: "post" });
};

export const sendAuthCode = (params) => {
  return request({ url: "/email/sendAuthCode", params, method: "get" });
}

export const task = (params) => {
  return request({ url: `/meshy/task/${params.taskId}`, method: "get" });
}

export const imageTask = (params) => {
  return request({ url: `/meshy/imageTask/${params.taskId}`, method: "get" });
}

export const meshyrefine = (data) => {
  const previewTaskId = data.previewTaskId;
  return request({url: `/meshy/refine`, previewTaskId, headers: null, method:'post'})
} 